import requests

url = 'http://www.baidu.com'

headers = {
    "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
}

data = requests.post(url,headers=headers).content.decode('utf-8')

with open('02post.html','w', encoding='utf-8') as f:
    f.write(data)